package farmer.game;

import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import core.game.StateBasedGame;
import core.state.BasicState;
import farmer.gui.TutorialGUI;

public class TutorialState extends BasicState{

	private BufferedImage image;
	private TutorialGUI gui;
	
	public TutorialState(StateBasedGame game, int stateID) {
		super(game, stateID);
	}
	
	public void keyPressed(KeyEvent e){
		if(e.getKeyCode() == KeyEvent.VK_R){
			getGame().enterState(FarmerBoyGame.MainMenu);
		}
	}

	@Override
	public void enter() {
		if(image == null){
			try {
				image = ImageIO.read(new File("tutorialScreen.png"));
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		gui = new TutorialGUI(this);
	}

	@Override
	public void init() {
		
	}

	@Override
	public void render(Graphics2D g) {
		g.drawImage(image, 0, 0, null);
		if(gui != null){
			gui.render(g);
		}
	}

	@Override
	public void update(int deltaTime) {
		// TODO Auto-generated method stub
		
	}

}
